import request from '../utils/request'

// 获取系统统计
export function getSystemStats() {
  return request({
    url: '/admin/stats',
    method: 'get'
  })
}

// 获取今日统计
export function getTodayStats() {
  return request({
    url: '/admin/today-stats',
    method: 'get'
  })
}

// 获取最近订单
export function getRecentOrders(params) {
  return request({
    url: '/admin/recent-orders',
    method: 'get',
    params
  })
}

// 获取用户列表
export function getUsers(params) {
  return request({
    url: '/admin/users',
    method: 'get',
    params
  })
}

// 更新用户状态
export function updateUserStatus(id, status) {
  return request({
    url: `/admin/users/${id}/status`,
    method: 'put',
    data: { status }
  })
}

// 删除用户
export function deleteUser(id) {
  return request({
    url: `/admin/users/${id}`,
    method: 'delete'
  })
}

// 获取商家列表
export function getAdminMerchants(params) {
  return request({
    url: '/admin/merchants',
    method: 'get',
    params
  })
}

// 审核商家
export function reviewMerchant(id, status, reason) {
  return request({
    url: `/admin/merchants/${id}/review`,
    method: 'put',
    data: { status, reason }
  })
}

// 删除商家
export function deleteMerchant(id) {
  return request({
    url: `/admin/merchants/${id}`,
    method: 'delete'
  })
}

// 获取订单列表
export function getAdminOrders(params) {
  return request({
    url: '/admin/orders',
    method: 'get',
    params
  })
}

// 获取数据统计
export function getStatistics(params) {
  return request({
    url: '/admin/statistics',
    method: 'get',
    params
  })
}
